// If we are transferring datasets via OpenCL, I believe the memory needs to be contiguous, thus we shouldn't use structs. 
// Let's just have one data type, a *float, with the first two elements the row & column dimensions of the following vector.
// Then it will be trivial to access with a macro.
//
//
//
/

float *init_Rnm(uint n, uint m) {
	float *r=new float[2+n*m];
	r[0]=n;
	r[1]=m;
	return r;

}

/*float access_Rmn(float *Rmn, uint i, uint j) {
	assert(i<=Rmn[0] && j<=Rmn[1]);
	return Rmn[2+Rmn[0]*i+j];
}*/



/*struct Rn {
	float *f;
	uint n;
};


struct Rmn {
	struct Rn **f;
	uint n; //only dealing with rectangles so might as well keep this
	uint m;
};

struct svd {
	struct Rn *values;
	struct Rmn *vectors;
	uint n;
};


void destroy_Rn ( struct Rn *d) {
	if (d!=NULL) {
		delete d->f;//free(d->f);
		delete d; //free(d);
	}
	d=NULL;
}

void destroy_Rmn( struct Rmn *d) {
	if (d!=NULL) {
		for (uint i=0;i<d->m;i++)
			destroy_Rn(d->f[i]);//free(d->f[i]);
		delete d->f;//free(d->f);
	delete d;//free(d);
	}
	d=NULL;
}

void destroy_svd(struct svd *ed) {
	if (ed!=NULL) {
		destroy_Rmn(ed->vectors);
		destroy_Rn(ed->values);
	delete ed;
							}
}

struct Rn *init_Rn (uint n, bool random) {
	struct Rn *d=new Rn;
	d->n=n;
	d->f=new float[n]();
	float u1=0,u2=0;
	if (random)
		for (uint i=0;i<n;i++) {
			if (i%2==0)
				u1=u01(), u2=u01();
		d->f[i]=STDEV*n01(u1,u2,i%2);
		}
	return d;
}
*/
